import layoutHeaderAside from '@/layout/header-aside'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

const meta = { auth: true }

export default {
  path: '/demo/playground',
  name: 'demo-playground',
  icon: 'flask',
  meta: { ...meta, title: '功能' },
  redirect: { name: 'demo-playground-index' },
  component: layoutHeaderAside,
  children: [
    {
      path: 'index',
      icon: 'home',
      name: 'demo-playground-index',
      component: _import('demo/playground/index'),
      meta: { ...meta, title: '功能' }
    },
    {
      path: 'store',
      icon: 'bolt',
      component: layoutHeaderAside,
      meta: { ...meta, title: '全局状态管理' },
      children: [
        {
          path: 'page',
          icon: 'window-restore',
          name: 'demo-playground-store-page',
          component: _import('demo/playground/store/page'),
          meta: {
            ...meta,
            cache: true,
            title: '多标签页控制'
          }
        },
        {
          path: 'menu',
          icon: 'bars',
          name: 'demo-playground-store-menu',
          component: _import('demo/playground/store/menu'),
          meta: { ...meta, title: '菜单配置' }
        },
        {
          path: 'size',
          icon: 'font',
          name: 'demo-playground-store-size',
          component: _import('demo/playground/store/size'),
          meta: { ...meta, title: '全局尺寸' }
        },
        {
          path: 'ua',
          icon: 'info-circle',
          name: 'demo-playground-store-ua',
          component: _import('demo/playground/store/ua'),
          meta: { ...meta, title: '浏览器信息' }
        },
        {
          path: 'gray',
          icon: 'eye',
          name: 'demo-playground-store-gray',
          component: _import('demo/playground/store/gray'),
          meta: {
            ...meta,
            title: '灰度模式'
          }
        },
        {
          path: 'fullscreen',
          icon: 'arrows-alt',
          name: 'demo-playground-store-fullscreen',
          component: _import('demo/playground/store/fullscreen'),
          meta: { ...meta, title: '全屏' }
        },
        {
          path: 'theme',
          icon: 'diamond',
          name: 'demo-playground-store-theme',
          component: _import('demo/playground/store/theme'),
          meta: { ...meta, title: '主题' }
        },
        {
          path: 'transition',
          icon: 'toggle-on',
          name: 'demo-playground-store-transition',
          component: _import('demo/playground/store/transition'),
          meta: { ...meta, title: '页面过渡开关' }
        }
      ]
    },
    {
      path: 'page-cache',
      icon: 'hdd-o',
      component: layoutHeaderAside,
      meta: { ...meta, title: '全局状态管理' },
      children: [
        {
          path: 'on',
          name: 'demo-playground-page-cache-on',
          component: _import('demo/playground/page-cache/on.vue'),
          meta: { ...meta, cache: true, title: '开启缓存' }
        },
        {
          path: 'off',
          name: 'demo-playground-page-cache-off',
          component: _import('demo/playground/page-cache/off.vue'),
          meta: { ...meta, title: '关闭缓存' }
        },
        {
          path: 'params/:id',
          name: 'demo-playground-page-cache-params',
          component: _import('demo/playground/page-cache/params.vue'),
          meta: { ...meta, cache: true, title: '带参路由缓存' },
          props: true
        }
      ]
    },
    {
      path: 'page-argu',
      icon: 'assistive-listening-systems',
      component: layoutHeaderAside,
      meta: { ...meta, title: '参数传递和留存' },
      children: [
        {
          path: 'send',
          name: 'demo-playground-page-argu-send',
          component: _import('demo/playground/page-argu/send.vue'),
          meta: { ...meta, title: '发送' }
        },
        {
          path: 'get/:username',
          name: 'demo-playground-page-argu-get',
          component: _import('demo/playground/page-argu/get.vue'),
          meta: { ...meta, title: '接收' }
        }
      ]
    },
    {
      path: 'db',
      icon: 'database',
      component: layoutHeaderAside,
      meta: { ...meta, title: '数据持久化' },
      children: [
        {
          path: 'all',
          icon: 'table',
          name: 'demo-playground-db-all',
          component: _import('demo/playground/db/all'),
          meta: { ...meta, title: '总览' }
        },
        {
          path: 'public',
          icon: 'users',
          name: 'demo-playground-db-public',
          component: _import('demo/playground/db/public'),
          meta: { ...meta, title: '公共存储' }
        },
        {
          path: 'user',
          icon: 'user',
          name: 'demo-playground-db-user',
          component: _import('demo/playground/db/user'),
          meta: { ...meta, title: '私有存储' }
        },
        {
          path: 'page-public',
          icon: 'file-o',
          name: 'demo-playground-db-page-public',
          component: _import('demo/playground/db/page-public'),
          meta: { ...meta, title: '路由存储' }
        },
        {
          path: 'page-user',
          icon: 'file-o',
          name: 'demo-playground-db-page-user',
          component: _import('demo/playground/db/page-user'),
          meta: { ...meta, title: '私有路由存储' }
        },
        {
          path: 'page-snapshot-public',
          icon: 'file',
          name: 'demo-playground-db-page-snapshot-public',
          component: _import('demo/playground/db/page-snapshot-public'),
          meta: { ...meta, title: '路由快照' }
        },
        {
          path: 'page-snapshot-user',
          icon: 'file',
          name: 'demo-playground-db-page-snapshot-user',
          component: _import('demo/playground/db/page-snapshot-user'),
          meta: { ...meta, title: '私有路由快照' }
        }
      ]
    },
    {
      path: 'log',
      icon: 'bullseye',
      component: layoutHeaderAside,
      meta: { ...meta, title: '日志' },
      children: [
        {
          path: 'ajax',
          icon: 'bug',
          name: 'demo-playground-log-ajax',
          component: _import('demo/playground/log/ajax'),
          meta: { ...meta, title: 'Ajax 错误' }
        },
        {
          path: 'console',
          icon: 'lightbulb-o',
          name: 'demo-playground-log-console',
          component: _import('demo/playground/log/console'),
          meta: { ...meta, title: '控制台日志' }
        },
        {
          path: 'error',
          name: 'demo-playground-log-error',
          icon: 'bug',
          component: _import('demo/playground/log/error'),
          meta: { ...meta, title: '错误捕捉' }
        },
        {
          path: 'log',
          name: 'demo-playground-log-log',
          icon: 'dot-circle-o',
          component: _import('demo/playground/log/log'),
          meta: { ...meta, title: '日志记录' }
        }
      ]
    },
    {
      path: 'add-routes',
      icon: 'plus-square',
      component: layoutHeaderAside,
      meta: { ...meta, title: '动态添加路由' },
      children: [
        {
          path: 'routes',
          icon: 'file-o',
          name: 'demo-playground-add-routes-routes',
          component: _import('demo/playground/add-routes/routes'),
          meta: { ...meta, title: '添加页面' }
        }
      ]
    },
    {
      path: 'env',
      name: 'demo-playground-env',
      component: _import('demo/playground/env'),
      meta: { ...meta, title: '环境信息' },
      icon: 'exclamation-circle'
    },
    {
      path: 'locales',
      name: 'demo-playground-locales',
      component: _import('demo/playground/locales'),
      meta: { ...meta, title: '国际化' },
      icon: 'language'
    }
  ]
}
